import http from '@/utils/request'

/***** 后台管理 注册用户(user) 模块 *******/
const prefix = "admin/v1/user/"

//===============================================
// 用户列表（分页） POST
// 参数名	参数说明	备注
// 页号   pageIndex
// 页大小 pageSize
// 搜索 keyword (在用户名中匹配)
// 排序 orderBy
export function getPage(params) {
  let {pageIndex, pageSize, keyword, orderBy} = params;
  return http.request({
    url: prefix + "queryPage",
    method: "post",
    data: {page: pageIndex, limit: pageSize, keyword, orderBy},
  });
}

//删除用户By用户Id		DELETE
export function deleteById(id) {
  return http.request({
    url: prefix + id,
    method: "delete",
  });
}

//修改用户		POST
export function update(params) {
  return http.request({
    url: prefix + "/update",
    method: "post",
    data: params,
  });
}

// 查询用户ById GET
export function getDetailById(id) {
  return http.request({
    url: prefix + id,
    method: "get",
  });
}

//重置用户密码By用户Id		POST  /resetPassword
export function resetPasswordById(id, password) {
  return http.request({
    url: prefix + "resetPassword",
    method: "post",
    data: {id, password},
  });
}
